﻿#region Header

/*
Remote views based on linq
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/

#endregion

#region Usings

#endregion

using System.Collections.Generic;

namespace Sebastof.Services.Interfaces {
	/// <summary>
	/// Is responsible for 
	/// - locating cached values, cached values are located by a string based key
	/// - reloading of these cached values if requested
	/// </summary>
	public interface ICachedDataLocatorService {
		#region Public Methods

		/// <summary>
		/// get cached entry for the given key
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="key"></param>
		/// <returns></returns>
		T GetCachedData<T>(string key);

		/// <summary>
		/// get cached entry for the given key
		/// if not available, returns the default value
		/// </summary>
		/// <typeparam name="T"></typeparam>
		/// <param name="key"></param>
		/// <param name="defaultData"></param>
		/// <returns></returns>
		T GetCachedData<T>(string key, T defaultData);

		object GetCachedObject(string key);

		/// <summary>
		/// get if a value for the exits
		/// </summary>
		/// <param name="key"></param>
		/// <returns></returns>
		bool ContainsKey(string key);

		/// <summary>
		/// refresh the given cashed value
		/// </summary>
		/// <param name="key"></param>
		/// <param name="freshData"></param>
		void RefreshObject(string key, Dictionary<string, object> freshData, object freshObject);

		#endregion
	}
}